﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Models;
using BLL;
using System.Data;

namespace Dryricenet
{
    public partial class home_SC : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string name = Session["Name"].ToString();
                DataTable dt = userBLL.selectNameBll(name);
                DataRow dr = dt.Rows[0];//第一条数据
                int userID = Convert.ToInt32(dr["UserID"].ToString());
                int FoodID = Convert.ToInt32(Request.QueryString["FoodID"]);
                    Collection c = new Collection();
                    c.FoodID = FoodID;
                    c.UserID = userID;
                    c.Time = DateTime.Now;
                    CollectionBLL.collectionSCBLL(c);
                Response.Redirect("home_Details.aspx?FoodID=" + FoodID);

            }
        }
    }
}